//
//  SerchDetilVC.m
//  Gegeda_music_MY
//
//  Created by lanou3g on 15/11/11.
//  Copyright © 2015年 周莹. All rights reserved.
//

#import "SerchDetilVC.h"
#import "SearchHeaper.h"
#import "SearchViewController.h"
#import "UIImageView+WebCache.h"
#import "SerchModel.h"
#import "MusicDataTool.h"
#import <AVFoundation/AVFoundation.h>
#import "LyricCell.h"
#import "LyricModel.h"
#import "UIView+Extension.h"

@interface SerchDetilVC ()<UITableViewDataSource,UITableViewDelegate>

//播放器
@property(nonatomic,strong)AVPlayer *player;

//播放进度定时器
@property(nonatomic,strong)NSTimer *progressTimer;

//歌词所在的数组
@property(nonatomic,strong)NSArray *lyricDataArray;

//记录当前选中的行(歌词)
@property(nonatomic,assign)NSInteger  currentSelectRow;

//歌曲所在的大背景

@property (weak, nonatomic) IBOutlet UIImageView *backImage;
//  播放按钮
@property (weak, nonatomic) IBOutlet UIButton *playbutton;
// 整个进度条
@property (weak, nonatomic) IBOutlet UIView *ProgressBackGroudview;
// 当前的进度
@property (weak, nonatomic) IBOutlet UIView *currentProgressView;
// 进度条上面的滑竿
@property (weak, nonatomic) IBOutlet UIButton *progressThumbButton;
// 总时间的 label
@property (weak, nonatomic) IBOutlet UILabel *musicSumTimelabel;
//展示歌词的 tableView
@property (weak, nonatomic) IBOutlet UITableView *lyricYableView;
// 转圈的 imageView
@property (weak, nonatomic) IBOutlet UIImageView *rotateimageview;

// 当前播放的音乐的模型
@property(nonatomic,strong)SerchModel *currentPlayMusicModel;

@end

@implementation SerchDetilVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBar.translucent = NO;
    //设置展示歌词tableView
    self.lyricYableView .delegate = self;
    self.lyricYableView.dataSource = self;
    self.rotateimageview.layer.cornerRadius = 33;
    self.rotateimageview.layer.masksToBounds = YES;
    
    
    
    
    
}


//展示播放页面,并且开始播放
-(void)showPlayViewAndStartPlay{

//获取window
    UIWindow *window = [UIApplication  sharedApplication].keyWindow;
    //设置播放页面的大小
    self.view.frame = window.bounds;
    //将当前控制器的view添加到window上面
    [window  addSubview:self.view];
    self.view.hidden = NO;
     // 让 view 从小面跳出来（利用动画实现）
    self.view.y = window.bounds.size.height;
#warning 动画开始的时候应该关闭用户交互。。。在动画结束的时候开启交互
    window.userInteractionEnabled =NO;
        // 执行动画弹出 view
[UIView  animateWithDuration:1.0f animations:^{
    self.view.y = 0;
    
}completion:^(BOOL finished) {
    window.userInteractionEnabled = YES;

//    // 重置数据
//    [self resetPlayingMusic];
//    // 开始播放
//    [self startPlayMusic];

    
}];

}













-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;

}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static  NSString *ID = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell = [[UITableViewCell  alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
    }
    return cell;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    return 20;

}

@end
